<template>
  <div>
    <div class="addBrand-container" id="food-add-app">
      <div class="container">
        <el-form ref="aGoodsData" :model="aGoodsData" :inline="true" label-width="180px" class="demo-ruleForm">
          <div><el-form-item label="商品编号:" >{{aGoodsData.commodityId}}</el-form-item></div>
          <div><el-form-item label="商品名称:">{{ aGoodsData.commodityName }}</el-form-item></div>
          <div><el-form-item label="商品类型:">{{aGoodsData.commodityType}}</el-form-item></div>
          <div><el-form-item label="商品信息:">{{ aGoodsData.commodityDetails }}</el-form-item></div>
          <div><el-form-item label="商品分类:">{{aGoodsData.catId}}</el-form-item></div>
          <div><el-form-item label="供应商名称:">{{ aGoodsData.providerName }}</el-form-item></div>
          <div><el-form-item label="供应商联系方式:">{{aGoodsData.providerPhone}}</el-form-item></div>
          <div><el-form-item label="服务保障:">{{ aGoodsData.serviceTreaty }}</el-form-item></div>

          <div><el-form-item label="不发货地区:">{{aGoodsData.unshipAddress}}</el-form-item></div>
          <div><el-form-item label="价格类型:">{{ aGoodsData.priceType }}</el-form-item></div>
          <div><el-form-item label="积分价格:">{{aGoodsData.integralPrice}}</el-form-item></div>
          <div><el-form-item label="商品名称:">{{ aGoodsData.commodityName }}</el-form-item></div>


          <div style="margin-left: 400px" class="subBox address">
            <el-form-item>
              <el-button @click="goBack">取消</el-button>
            </el-form-item>
          </div>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
// import EDesc from './e-desc'
// import EDescItem from './e-desc-item'
import axios from "axios";

export default {
  // components: {
  //   EDesc, EDescItem
  // },
  data () {
    return {
      aGoodsData: {
        "commodityId": 6,
        "commodityName": "商品名称",
        "commodityDetails": "商品信息",
        "catId": 1,
        "providerName": "提供者名",
        "providerPhone": "电话",
        "serviceTreaty": "保障",
        "unshipAddress": "辽宁省崇左市韶山市",
        "priceType": "纯现金",
        "integralPrice": 0,
        "price": 5.5,
        "onlineTime": "2021-12-08 05:59:01",
        "downlineTime": "1999-07-04 03:11:10",
        "dropSite": "湖南省....",
        "inventory": 600,
        "photo": "http://dummyimage.com/400x400",
        "exchangeRange": 20,
        "commodityType": "类型",
        "commodityStatus": 3
      },
    }
  },
  methods:{
    test(){
      console.log(this.$route.query.id)
    },
    goBack(){
      this.$router.push({
        name:'GoodsList'
      })
    }
  },
  mounted() {
    axios({
      // TODO 查询商品id查询商品
      url:"/goods/get/by/commodityId",
      method:'get',
      params: {
        'commodityId': this.$route.query.commodityId
      }
    }).then(res=>{
      // 响应成功
      this.aGoodsData = res.data.data;
    },err=>{
      console.log("未响应....")
    })
  }
}
</script>
